//
//  CartModel.m
//  StandardizedProduct
//
//  Created by 宁宁 on 16/6/24.
//  Copyright © 2016年 ym. All rights reserved.
//

#import "CartModel.h"

@implementation CartModel

+ (CartModel *)parseUserWithDictionary:(NSDictionary *)dict{
    CartModel *model = [[CartModel alloc] init];
    
    /**价格*/
    model.price = [NSString stringWithFormat:@"%@", dict[@"PRICE"]];
    /**数量*/
    model.num = [NSString stringWithFormat:@"%@", dict[@"Count"]];
    /**颜色尺寸*/
    if ([[NSString stringWithFormat:@"%@", dict[@"COLOR"]] isEqualToString:@"(null)"] || [[NSString stringWithFormat:@"%@", dict[@"COLOR"]] isEqualToString:@""]) {
        model.colorAndSize = [NSString stringWithFormat:@"%@", dict[@"SIZENAME"]];
    }else if ([[NSString stringWithFormat:@"%@", dict[@"SIZENAME"]] isEqualToString:@"(null)"] || [[NSString stringWithFormat:@"%@", dict[@"SIZENAME"]] isEqualToString:@""]){
        model.colorAndSize = [NSString stringWithFormat:@"%@", dict[@"COLOR"]];
    }else model.colorAndSize = [NSString stringWithFormat:@"%@,%@", dict[@"COLOR"], dict[@"SIZENAME"]];
    /**商品名*/
    model.goodsName = [NSString stringWithFormat:@"%@", dict[@"PRODUCTNAME"]];
    /**商品简介*/
    model.goodsDetail = @"";
    /**商品图片*/
    model.IMGURL = [NSString stringWithFormat:@"%@%@", BaseURLStringString, dict[@"IMGURL"]];
    /**SKU*/
    model.SKU = [NSString stringWithFormat:@"%@", dict[@"SKU"]];
    /**SKUId*/
    model.SKUID = [NSString stringWithFormat:@"%@", dict[@"SKUID"]];
    /**ProductCode*/
    model.ProductCode = [NSString stringWithFormat:@"%@", dict[@"ProductCode"]];
    /**商品ID*/
    model.Id = [NSString stringWithFormat:@"%@", dict[@"STYLEID"]];
    /**购物车主键*/
    model.CartID = [NSString stringWithFormat:@"%@", dict[@"CartID"]];
    
    return model;
}

@end
